﻿using Furion.DatabaseAccessor;
using Furion.DynamicApiController;
using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using PIP.Core;
using PIP.Core.Entites.Yygh;
using PIP.Core.Entites.Yygh.DTO;
using System.Collections.Generic;
using System.Threading.Tasks;


namespace Furion.Application
{

    /// <summary>
    ///预约挂号，对接医院业务和临沂市健康平台
    /// </summary>
    [ApiDescriptionSettings("BaseDataServices", Tag = "预约挂号服务")]
    [AllowAnonymous]
    public class YyghService : IYyghService, IDynamicApiController
    {
        private readonly IRepository<HospitalDepartment, YyghContextLocator> repository;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="configuration"></param>
        public YyghService(IRepository<HospitalDepartment, YyghContextLocator> repository)
        {
            this.repository = repository;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        [HttpPost("getDepartList")]
        public async Task<List<getDoctorListDTO_Out>> getDepartList(getDoctorListDTO_In item)
        {
            var roles = await repository.Where(c => c.merchId == item.merchId).ToListAsync();
            return roles.Adapt<List<getDoctorListDTO_Out>>();
        }

    }
}
